package test07.t01;

/**
 * @Author lzp
 * @Date 2024-04-11
 */
public class Test {
    public static void main(String[] args) {

        // void sayHello(String name);
        WenHou wenHou = (name) -> {
            System.out.println("你好"+name);
        };
        wenHou.sayHolle("土豆");

        //成员方法的引用 - 取代Lambda表达式
        User user =new User();
        WenHou wenHou1 = user::goodMorning;
        wenHou1.sayHolle("傻椿");

        WenHou wenHou2 = User::goodAfternoon;
        wenHou2.sayHolle("zhangsan");

        //错误：引用的方法与函数式接口的抽象方法不匹配
        //参数必须一致 and 返回值相兼容
        //WenHou wenHou3 = User::goodNight;

    }
}
